/* $RCSFile: LocalizedCategoryAttribute.cs $
 * Apache license v2 2011 by Christian Surieux
 * $Source: ?/ADNCRM.ServerControls/LicenceControls/LocalizedCategoryAttribute.cs $
 * $log$
 * Revision 6 2010/08/06 19:56:30  christian.surieux
 *   Added Log to All cs files
 */

// LocalizedCategoryAttribute.cs
// Server Controls and Components
//

using System;
using System.Diagnostics;
using System.ComponentModel;

namespace ADNCRM.ServerControls {

    [AttributeUsage(AttributeTargets.All)]
    internal sealed class LocalizedCategoryAttribute : CategoryAttribute 
    {

        public LocalizedCategoryAttribute(string resourceKey) : base(resourceKey) 
        {}

        protected override string GetLocalizedString(string value) 
        {
            string localizedValue = base.GetLocalizedString(value);

            if (localizedValue == null) {
                localizedValue = AssemblyResourceManager.GetString("Category_" + value);
            }
            Debug.Assert(localizedValue != null, "Resource string: 'Category_" + value + "' not found.");
            return localizedValue;
        }
    }
}
